package com.jzy;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.DispatcherServlet;

import com.jzy.common.utils.ApplicationContextHelper;

@SpringBootApplication
//1.ApplicationContextHelper再同一个包下面,ApplicationContextHelper可以使用@Component注解
//2.ApplicationContextHelper不再同一个包内，不使用注解且再@SpringBootApplication注释下面添加@Import(value={ApplicationContextHelper.class})
//3.ApplicationContextHelper不再同一个包内，再main方法内使用ApplicationContextHelper.setApplicationContext(context);
public class Application extends SpringBootServletInitializer {


    /*
     * 外部tomcat启动使用
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(Application.class);
	}*/
	
	public static void main(String[] args) {
		ConfigurableApplicationContext context =SpringApplication.run(Application.class,args);
		ApplicationContextHelper.setApplicationContext(context);
	}
}
